home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1271 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.4 KB  |  34 lines

  1. Path: lasernet.com!jonathan_wooldridge
  2. Newsgroups: comp.lang.c++
  3. Message-ID: <60109230008$71C7@lasernet.com>
  4. X-Gateway: Act-Up 4.6  09 Jan 96 23:00:08  LaserNet, Serving Fido style systems
  5. Date: Tue, 9 Jan 96 21:08:45 LOC
  6. Organization: 1BBS ■ Imperial Beach CA ■ 619∙429∙6521/6123 ■ (52:1000/153)
  7. From: Jonathan Wooldridge <jonathan_wooldridge@lasernet.com>
  8. In-Reply-To: Eric Novinscak
  9. Subject: Randomizer
  10.  
  11. -=> Quoting Eric Novinscak to All <=-
  12.  EN> Fm IntrNet:  kerning@nbnet.nb.ca  [comp.lang.c++]
  13.  EN> I got a little die rolling program and I'm trying to get it to roll a
  14.  EN> different side each time you run the program but it always ends up on
  15.  EN> the same side on the final roll.  I'm using Borland C++ 4.5 with the
  16.  EN> randomizer function and random. Can anyone help please!!!!  
  17.  
  18. Firstly, be sure to #include <time.h> as the random funcs depend on the clock.
  19. Secondly, be sure to
  20.     randomize();
  21.     before actually using the random functions. This way you will get a
  22.     different series each time. However, I've tried this with Borland v3.1,
  23.     and the results weren't very random. To be sure, the bell curve was ok,
  24.     but it usually decayed into an obvious series relatively quickly.
  25.  
  26. Snippits has source for an excellent algorithm for random number generation.
  27.     if you would like, I'll send you several source files.
  28.  
  29.                  -SpyroGyra
  30. ---
  31.  ■ TLX v4.00 ■ Documentation - The worst part of programming.
  32.  
  33. ---
  34.